﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SISGEZATBZVisual.BusinessEntities;

namespace SISGEZATBZVisual.Repository.Mapping
{
   public class PagoMap:EntityTypeConfiguration<Pago>
   {
       public PagoMap()
       {
           this.HasKey(r => r.Id);

           //propiedades
           this.Property(r => r.Id)
               .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

           this.Property(r => r.FechaPago)
               .IsRequired();


           //table
           this.ToTable("Pago");

           //Relaciones
           this.HasRequired(r => r.TipoPago)
               .WithMany()
               .HasForeignKey(r => r.IdTipoPago)
               .WillCascadeOnDelete(false);
       }

   }
}
